<template>
	<view class="wrapBgc">
		<button type="default" @tap="loginEvent">{{ loginBtnText }}</button>
		<player></player>
	</view>
</template>

<script>
	import player from '../../components/player.vue'
	export default {
		data() {
			return {
				loginBtnText: '立即登录',
				loginStatus: true
			}
		},
		methods: {
			loginEvent() {
				if(uni.getStorageSync("userInfo").uid) {
					// 如果是登录状态，点击之后就发送退出登录请求
					// this.$http.queryloginStatus()
					this.$http.logout()
					this.loginBtnText = '立即登录'
				} else {
					// 如果未登录，点击之后就转到登陆页面
					uni.navigateTo({
						url: '../loginCloudMusic/loginCloudMusic'
					})
				}
			}
		},
		components:{
			player
		},
		onLoad() {
			let userInfo = uni.getStorageSync("userInfo")
			if(userInfo.uid) {
				this.loginBtnText = '退出登录'
			} else {
				this.loginBtnText = '立即登录'
			}
			console.log('我的页面showed')
			// this.$http.getUserInfo(userInfo.uid)
			this.$http.getAccountInfo()
		}
	}
</script>

<style>

</style>
